<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/init.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<jsp:include page="/WEB-INF/jsp/common/common.jsp" />
<jsp:include page="/WEB-INF/jsp_lib/validate.jsp" />
<script type="text/javascript">
	$(function() {
		$("#form1").validate({
			rules : {
				'page_width' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'page_height' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'sound_print_res' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'sound_print_start' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'time_apart' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'time_first_stop_' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'work_type' : {
					required : true,
					maxlength : 99
				},
				'time_detail_width' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'time_detail_height' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'user_width' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'user_height' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'seal_width' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'seal_height' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'seal_stop_time' : {
					required : true,
					maxlength : 13,
					number : true
				},
				'paper_id' : {
					required : true
				}
			}
		});
		var macconfig = "${macConfig}";
		var type = "${type}"
		$("#macselect").val("${type}");
		$("#paperselect").val("${macConfig.paper_id}");
		if (macconfig != "" && type != "") {
			$("#a1").show();
			$("#a2").hide();
			$("table").show();
		} else {
			$("table").hide();
			$("#a1").hide();
			//$("#a2").hide();
		}
		;
	});

	function myshow() {
		var type = $('#macselect option:selected').val();
		if (type == "请选择") {
			alert("请选择设备之后点击添加");
		} else {
			$("table").show();
			$("#a2").hide();
			$("#a1").show();
		}
		;
	}

	function mysubmit(type) {
		window.location.href = "${path}/ix/config/mac/list.htm?type=" + type;
	}

	function add(macconfig_id) {
		var url = "${path}/ix/config/mac/add.htm"
		$("#form1").attr("action", url);
		$("#form1").submit();
	}
	function paperlist() {
		window.location.href = "${path}/ix/config/paper/list.htm";

	}
</script>
</head>
<body>
	<jsp:include page="/WEB-INF/jsp_lib/tip.jsp" />
	<!-- 内容 -->
	<div>
		<form method="post" action="${path}/ix/config/mac/list.htm" id="form1">
			<input type="hidden" name="mac_id" value="${mac_id}"> <input
				type="hidden" name="macconfig_id" value="${macConfig._id}">
					<h2>
						<div>
							请选择需要配置的设备:<select id="macselect" name="type"
								onchange="mysubmit(this.value)">
								<option value="请选择">请选择设备</option>
								<c:forEach items="${macList}" var="v">
									<option value="${v._id}">${v.mac}</option>
								</c:forEach>
							</select>
						</div>
					</h2>
					<table width="100%" class="lindex">

						<tr>
							<th align="right">纸张宽度</th>
							<td align="left"><select id="paperselect" name="paper_id">
									<option value="">请选择纸张</option>
									<c:forEach items="${paperList}" var="v">
										<option value="${v._id}">${v.name}</option>
									</c:forEach>
							</select> <input name="page_width" value="${macConfig.page_width}"
								rows="5" cols="50" placeholder="宽度">* <input
									name="page_height" value="${macConfig.page_height}" rows="5"
									cols="50" placeholder="高度"></td>
						</tr>
						<tr>
							<th align="right">打印开始响应时蜂鸣次数:</th>
							<td align="left" colspan="3"><input name="sound_print_res"
								value="${macConfig.sound_print_res}" type="text" maxlength="100" />
							</td>
						</tr>
						</tr>
						<tr>
							<th align="right">打印开始时蜂鸣次数:</th>
							<td align="left"><input name="sound_print_start"
								value="${macConfig.sound_print_start}" rows="5" cols="50"></td>
						</tr>
						<tr>
							<th align="right">盖章与打印之间的时间间隔</th>
							<td align="left"><input name="time_apart"
								value="${macConfig.time_apart}" rows="5" cols="50">
									单位：0.1毫米(mm) </td>
						</tr>
						<tr>
							<th align="right">第一次盖章额外停留时间</th>
							<td align="left"><input name="time_first_stop_"
								value="${macConfig.time_first_stop_}" rows="5" cols="50">
									单位：毫秒(ms) </td>
						</tr>
						<tr>
							<th align="right">设备工作方式</th>
							<td align="left"><input name="work_type"
								value="${macConfig.work_type}" rows="5" cols="50"></td>
						</tr>
						<tr>
							<th align="right">详细时间打印位置</th>
							<td align="left">x坐标:<input name="time_detail_width"
								value="${macConfig.time_detail_width}" rows="5" cols="50">y坐标:<input
									name="time_detail_height"
									value="${macConfig.time_detail_height}" rows="5" cols="50">
										单位：0.1毫米(mm),填写0表示不打印详细时间 </td>
						</tr>
						<tr>
							<th align="right">柜员号打印位置</th>
							<td align="left">x坐标:<input name="user_width"
								value="${macConfig.user_width}" rows="5" cols="50">y坐标:<input
									name="user_height" value="${macConfig.user_height}" rows="5"
									cols="50"> 单位：0.1毫米(mm),填写0表示不打印柜员号 </td>
						</tr>
						<tr>
							<th align="right">盖章位置</th>
							<td align="left">x坐标:<input name="seal_width"
								value="${macConfig.seal_width}" rows="5" cols="50">y坐标:<input
									name="seal_height" value="${macConfig.seal_height}" rows="5"
									cols="50"> 单位：0.1毫米(mm) </td>
						</tr>
						<tr>
							<th align="right">盖章停留时间</th>
							<td align="left"><input name="seal_stop_time"
								value="${macConfig.seal_stop_time}" rows="5" cols="50">
									单位：毫秒(ms) </td>
						</tr>
					</table>
					<div class="options">
						<a id="a1" href="javascript:add('${macConfig._id}');"
							class="asave"> 【保存】 </a> <a id="a2" href="javascript:myshow();"
							class="asave"> 选择设备后可【点击添加设备配置】 </a>
					</div>
		</form>
	</div>
</body>
</html>